<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    body,
    html {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        background-color: rgb(240, 108, 122);

    }

    .headbox {
        display: flex;
    }

    .textHeader {
        /* width: 100%; */
        height: 20px;
        color: #ffff;
        font-size: 16px;
        text-align: center;
        margin-top: 10px;
        margin-left: 27%;
        /* flex: 1; */

    }

    .leftlabel img {
        width: 20px;
        height: 20px;
        margin-top: 10px;
        margin-left: 30px;
    }

    .home {
        width: 100%;
        height: 200px;
        position: relative;
    }

    .centerhome {
        width: 100px;
        height: 100px;
        position: absolute;
        left: 50%;
        top: 50%;
        margin-left: -50px;
        margin-top: -50px;

    }

    .centerhome img {
        width: 100px;
        height: 100px;

    }

    .centerinput {
        width: 100%;
        height: 450px;
        position: relative;

    }

    .centerinput input {
        width: 70%;
        height: 40px;
        background-color: rgb(244, 124, 136);
        border-radius: 25px;
        margin-left: 50px;
        margin-top: 20px;
        border: none;






    }

    #whiwtebg {
        background-color: #ffff;
        color: rgb(240, 108, 122);
        /* 
        border: none;
        border-radius: 15px;
        margin-left: 100px; */

        width: 70%;
        height: 40px;
        /* background-color: rgb(244, 124, 136); */
        border-radius: 25px;
        margin-left: 50px;
        margin-top: 20px;
        border: none;


    }

    .msgbox {
        width: 100%;
        height: 40px;
        text-align: center;
        margin-top: 6px;
    }

    .msg {
        width: 100%;
        height: 30px;
        color: #ffff;
        text-align: center;
        font-size: 14px;
    }

    #color {
        color: floralwhite;
        text-indent: 15px;
        cursor: pointer;
    }
    #color1 {
        color: floralwhite;
        text-indent: 15px;
        cursor: pointer;
    }
</style>

<body>
    <header class="headbox">
        <div class="leftlabel">
            <img src="../img/向左_返回.png">
        </div>
        <div class="textHeader">登录账号</div>
    </header>
    <main>
        <div class="home">
            <div class="centerhome">
                <img src="../img/house.png">
            </div>
        </div>
        <div class="centerinput">
            <!-- <form id="loginForm" action="./商品列表.html" method="post"> -->
            <input type="text" placeholder="请输入账号" id="color">
            <input type="password" placeholder="请输入密码" id="color1">
            <!-- <input type="submit" value="立即登录" id="whiwtebg"><br> -->
            <button id="whiwtebg">立即登录</button>
            <!-- </form> -->
            <div class="msgbox">
                <span class="msg">还未注册账号，用户注册</span>
            </div>
        </div>
    </main>
    <footer></footer>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.5.0/axios.js"></script>
    <script>
           let account = document.querySelector('#color');
           let password = document.querySelector('#color1');
           console.log(account);
           console.log(password);


           let button = document.querySelector('button');
           button.addEventListener('click',function(){

           let data = { account: account.value,password: password.value }
            localStorage.setItem('data', JSON.stringify(data))
            console.log(data);
            axios.post('http://8.137.157.16:9000/user/login', { account: account.value, password: password.value })
                        .then(function (res) {
                            console.log(res);


                            window.location.href = './商品列表.html';
                        }).catch(function (err) {
                            console.log(err);
                        })
           })
          
           
    </script>

</body>

</html>